import win32com.client as win32

def open_ppt(file_path):
    ppt_app = win32.Dispatch('PowerPoint.Application')
    ppt_app.Visible = False
    ppt = ppt_app.Presentations.Open(file_path)
    return ppt, ppt_app

def read_slides(ppt):
    slides = []
    for slide in ppt.Slides:
        slide_content = []
        for shape in slide.Shapes:
            if hasattr(shape, "TextFrame") and shape.TextFrame.HasText:
                slide_content.append(shape.TextFrame.TextRange.Text)
        slides.append('\n'.join(slide_content))
    return slides

def modify_slide(ppt, slide_index, text_to_add):
    slide = ppt.Slides(slide_index)
    if slide.Shapes[1].HasTextFrame:
        text_frame = slide.Shapes[1].TextFrame
        text_frame.TextRange.InsertAfter(text_to_add + '\n')

def save_ppt(ppt, file_path):
    ppt.SaveAs(file_path)
    ppt.Close()

def main():
    file_path = r'C:\Users\lenovo\Desktop\translation.ppt'
    ppt, ppt_app = open_ppt(file_path)
    slides = read_slides(ppt)
    for i, slide_content in enumerate(slides):
        print(f'Slide {i+1}:\n{slide_content}\n')
    ppt_app.Quit()

if __name__ == '__main__':
    main()